// 回文字符串=对称字符串
var validPalindrome = function (s) {
    let length = s.length;
    let j = 0;
    let k = length - 1;
    while (j < k && s[j] === s[k]) {
        j++;
        k--;
    }
    // return isPalindrome(j + 1, k) || isPalindrome(j, k - 1);
    if (isPalindrome(j + 1, k)) {
        return true;
      }
      if (isPalindrome(j, k - 1)) {
        return true;
      }
    function isPalindrome(start, end) {
        while (start < end) {
            if (s[start] !== s[end]) {
                return false;
            }
            start++;
            end--;
        }
        return true;
    }
    return false;
};

console.log(validPalindrome("civict")); 
console.log(validPalindrome("abytewq"));  

var validPalindrome1 = function (s) {
    let length = s.length;
    let j = 0;
    let k = length - 1;
    while (j < k && s[j] === s[k]) {
        j++;
        k--;
    }
    return isPalindrome(j + 1, k) || isPalindrome(j, k - 1);
    function isPalindrome(start, end) {
        while (start < end) {
            if (s[start] !== s[end]) {
                return false;
            }
            start++;
            end--;
        }
        return true;
    }
};
  
  var validPalindrome0 = function (s) {
    let length = s.length;
    let j = 0;
    let k = length - 1;
    while (j < k && s[j] == s[k]) {
      j++;
      k--;
    }
   if (isPalindrome(j + 1, k)) {
        return true;
      }
      if (isPalindrome(j, k - 1)) {
        return true;
      }
    function isPalindrome(start, end) {
      while (start < end) {
        if (s[start] !== s[end]) {
          return false;
        }
        start++;
        end--;
      }
      return true;
    }
    return false;
  };